import regeneratorRuntime from '../utils/runtime'
import {loading,toast} from '../utils/ajaxSetting'
import {wxHttp} from '../ajax/ajax'
//  新增任务
const taskSave = async ({...options})=>{
	return wxHttp({
		name: 'task',
      	data: {
			$url: 'save',
			...options.data
		},
		loading: loading(true),
		// loading: options.loading===false? false : loading(true),
		// toast: options.toast===false? false :toast(true)
	})
}

const getListOpenId = async (options)=>{
	return wxHttp({
		name: 'task',
      	data: {
			$url: 'getListOpenId',
			...options
		},
		loading: loading(true),
	})
}

const taskList = async (options)=>{
	return wxHttp({
		name: 'task',
      	data: {
			$url: 'list',
			...options
		},
		loading: loading(true),
	})
}

const taskDetail= async (options)=>{
	return wxHttp({
		name: 'task',
      	data: {
			$url: 'detail',
			...options.data
		},
		loading: loading(true),
	})
}

const cancelTasks= async (options)=>{
	return wxHttp({
		name: 'task',
      	data: {
			$url: 'cancelTasks',
			id: options
		},
		loading: loading(true),
	})
}
export{
	taskSave,
	taskList,
	taskDetail,
	getListOpenId,
	cancelTasks
}
